<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:c="http://java.sun.com/jsp/jstl/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	template="/WEB-INF/layout/t.xhtml">

	<ui:define name="title">
		<h:outputText value="Amministrazione del portale" />
	</ui:define>
	<ui:define name="roles">
		<f:attribute name="roles" value="resource" />
	</ui:define>
	<ui:define name="content">
		<h:form>
			<p:growl />

			<p:fileUpload fileUploadListener="#{fileHandler.handleFileUpload}"
				multiple="true" label="Scegli #{fileHandler.fileName}"
				allowTypes="*" description="Scegli #{fileHandler.fileName}"
				update="filesList" />
			<br />
			<br />
			<p:dataTable id="filesList" var="file"
				value="#{fileHandler.daCaricare}">

				<p:column>
					<f:facet name="header">nome</f:facet>
					<h:outputText value="#{file.filename}" />
				</p:column>

				<p:column>
					<f:facet name="header">operazione</f:facet>
					<h:graphicImage value="/img/#{file.filename}"
						rendered="#{fileHandler.fileType == 1}"
						width="#{fileHandler.proportionalWidth(file.filename,50,50)}"
						height="#{fileHandler.proportionalHeight(file.filename,50,50)}" />
					<h:outputLink value="/js/#{file.filename}" target="_blank"
						rendered="#{fileHandler.fileType == 3}">[v]</h:outputLink>
					<h:outputLink value="/swf/#{file.filename}" target="_blank"
						rendered="#{fileHandler.fileType == 2}">[v]</h:outputLink>
					<h:outputLink value="/css/#{file.filename}" target="_blank"
						rendered="#{fileHandler.fileType == 0}">[v]</h:outputLink>
				</p:column>
			</p:dataTable>

		</h:form>

	</ui:define>
</ui:composition>